#[doc = "Register `LSADC_CTRL10` reader"]
pub struct R(crate::R<LSADC_CTRL10_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<LSADC_CTRL10_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<LSADC_CTRL10_SPEC>> for R {
    fn from(reader: crate::R<LSADC_CTRL10_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `LSADC_CTRL10` writer"]
pub struct W(crate::W<LSADC_CTRL10_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<LSADC_CTRL10_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<LSADC_CTRL10_SPEC>> for W {
    fn from(writer: crate::W<LSADC_CTRL10_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `lsadc_reg_3to0` reader - General register 4."]
pub struct LSADC_REG_3TO0_R(crate::FieldReader<u8, u8>);
impl LSADC_REG_3TO0_R {
    pub(crate) fn new(bits: u8) -> Self {
        LSADC_REG_3TO0_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for LSADC_REG_3TO0_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `lsadc_reg_3to0` writer - General register 4."]
pub struct LSADC_REG_3TO0_W<'a> {
    w: &'a mut W,
}
impl<'a> LSADC_REG_3TO0_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x0f << 24)) | (((value as u32) & 0x0f) << 24);
        self.w
    }
}
#[doc = "Field `lsadc_reg2_5to0` reader - General register 3."]
pub struct LSADC_REG2_5TO0_R(crate::FieldReader<u8, u8>);
impl LSADC_REG2_5TO0_R {
    pub(crate) fn new(bits: u8) -> Self {
        LSADC_REG2_5TO0_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for LSADC_REG2_5TO0_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `lsadc_reg2_5to0` writer - General register 3."]
pub struct LSADC_REG2_5TO0_W<'a> {
    w: &'a mut W,
}
impl<'a> LSADC_REG2_5TO0_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x3f << 16)) | (((value as u32) & 0x3f) << 16);
        self.w
    }
}
#[doc = "Field `lsadc_reg1_7to6` reader - General register 2."]
pub struct LSADC_REG1_7TO6_R(crate::FieldReader<u8, u8>);
impl LSADC_REG1_7TO6_R {
    pub(crate) fn new(bits: u8) -> Self {
        LSADC_REG1_7TO6_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for LSADC_REG1_7TO6_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `lsadc_reg1_7to6` writer - General register 2."]
pub struct LSADC_REG1_7TO6_W<'a> {
    w: &'a mut W,
}
impl<'a> LSADC_REG1_7TO6_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x03 << 12)) | (((value as u32) & 0x03) << 12);
        self.w
    }
}
#[doc = "Field `lsadc_reg1_3` reader - General register 1."]
pub struct LSADC_REG1_3_R(crate::FieldReader<bool, bool>);
impl LSADC_REG1_3_R {
    pub(crate) fn new(bits: bool) -> Self {
        LSADC_REG1_3_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for LSADC_REG1_3_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `lsadc_reg1_3` writer - General register 1."]
pub struct LSADC_REG1_3_W<'a> {
    w: &'a mut W,
}
impl<'a> LSADC_REG1_3_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
        self.w
    }
}
#[doc = "Field `lsadc_reg0_6to0` reader - General register 1."]
pub struct LSADC_REG0_6TO0_R(crate::FieldReader<u8, u8>);
impl LSADC_REG0_6TO0_R {
    pub(crate) fn new(bits: u8) -> Self {
        LSADC_REG0_6TO0_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for LSADC_REG0_6TO0_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `lsadc_reg0_6to0` writer - General register 1."]
pub struct LSADC_REG0_6TO0_W<'a> {
    w: &'a mut W,
}
impl<'a> LSADC_REG0_6TO0_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x7f) | ((value as u32) & 0x7f);
        self.w
    }
}
impl R {
    #[doc = "Bits 24:27 - General register 4."]
    #[inline(always)]
    pub fn lsadc_reg_3to0(&self) -> LSADC_REG_3TO0_R {
        LSADC_REG_3TO0_R::new(((self.bits >> 24) & 0x0f) as u8)
    }
    #[doc = "Bits 16:21 - General register 3."]
    #[inline(always)]
    pub fn lsadc_reg2_5to0(&self) -> LSADC_REG2_5TO0_R {
        LSADC_REG2_5TO0_R::new(((self.bits >> 16) & 0x3f) as u8)
    }
    #[doc = "Bits 12:13 - General register 2."]
    #[inline(always)]
    pub fn lsadc_reg1_7to6(&self) -> LSADC_REG1_7TO6_R {
        LSADC_REG1_7TO6_R::new(((self.bits >> 12) & 0x03) as u8)
    }
    #[doc = "Bit 8 - General register 1."]
    #[inline(always)]
    pub fn lsadc_reg1_3(&self) -> LSADC_REG1_3_R {
        LSADC_REG1_3_R::new(((self.bits >> 8) & 0x01) != 0)
    }
    #[doc = "Bits 0:6 - General register 1."]
    #[inline(always)]
    pub fn lsadc_reg0_6to0(&self) -> LSADC_REG0_6TO0_R {
        LSADC_REG0_6TO0_R::new((self.bits & 0x7f) as u8)
    }
}
impl W {
    #[doc = "Bits 24:27 - General register 4."]
    #[inline(always)]
    pub fn lsadc_reg_3to0(&mut self) -> LSADC_REG_3TO0_W {
        LSADC_REG_3TO0_W { w: self }
    }
    #[doc = "Bits 16:21 - General register 3."]
    #[inline(always)]
    pub fn lsadc_reg2_5to0(&mut self) -> LSADC_REG2_5TO0_W {
        LSADC_REG2_5TO0_W { w: self }
    }
    #[doc = "Bits 12:13 - General register 2."]
    #[inline(always)]
    pub fn lsadc_reg1_7to6(&mut self) -> LSADC_REG1_7TO6_W {
        LSADC_REG1_7TO6_W { w: self }
    }
    #[doc = "Bit 8 - General register 1."]
    #[inline(always)]
    pub fn lsadc_reg1_3(&mut self) -> LSADC_REG1_3_W {
        LSADC_REG1_3_W { w: self }
    }
    #[doc = "Bits 0:6 - General register 1."]
    #[inline(always)]
    pub fn lsadc_reg0_6to0(&mut self) -> LSADC_REG0_6TO0_W {
        LSADC_REG0_6TO0_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "LSADC_CTRL10 is the ADC reserve control register.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [lsadc_ctrl10](index.html) module"]
pub struct LSADC_CTRL10_SPEC;
impl crate::RegisterSpec for LSADC_CTRL10_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [lsadc_ctrl10::R](R) reader structure"]
impl crate::Readable for LSADC_CTRL10_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [lsadc_ctrl10::W](W) writer structure"]
impl crate::Writable for LSADC_CTRL10_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets LSADC_CTRL10 to value 0"]
impl crate::Resettable for LSADC_CTRL10_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
